<template>
  <div class="flex gap1">
    <el-popover trigger="click">
      <template #reference>
        <icon icon="solar:double-alt-arrow-right-linear" class="cursor-pointer" />
      </template>
      <div>
        <el-checkbox
          v-for="(column, i) in unit.columns"
          :key="i"
          :checked="!column.hidden"
          :value="column.field"
          :label="column.label"
          @change="checked => column.hidden = !checked" />
      </div>
    </el-popover>
  </div>
</template>
<script lang="ts" setup>
  import { ElPopover, ElCheckbox } from 'element-plus'
  import { Unit } from '@/seed-application/types'
  import { Icon } from '@/components/Icon'
  import { inject } from 'vue'
  import { unitKey } from '@/seed-application'

  const unit = inject<Unit>(unitKey, void 0)
</script>